\(\int \frac {\csc (x)}{a \cos (x)+b \sin (x)} \, dx\) [12]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 14, antiderivative size = 23 \[ \int \frac {\csc (x)}{a \cos (x)+b \sin (x)} \, dx=\frac {\log (\sin (x))}{a}-\frac {\log (a \cos (x)+b \sin (x))}{a} \]

[Out]

ln(sin(x))/a-ln(a*cos(x)+b*sin(x))/a

Rubi [A] (verified)

Time = 0.08 (sec) , antiderivative size = 23, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.214, Rules used = {3180, 3556, 3212} \[ \int \frac {\csc (x)}{a \cos (x)+b \sin (x)} \, dx=\frac {\log (\sin (x))}{a}-\frac {\log (a \cos (x)+b \sin (x))}{a} \]

[In]

Int[Csc[x]/(a*Cos[x] + b*Sin[x]),x]

[Out]

Log[Sin[x]]/a - Log[a*Cos[x] + b*Sin[x]]/a

Rule 3180

Int[1/(sin[(c_.) + (d_.)*(x_)]*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])), x_Symbol] :>
Dist[1/a, Int[Cot[c + d*x], x], x] - Dist[1/a, Int[(b*Cos[c + d*x] - a*Sin[c + d*x])/(a*Cos[c + d*x] + b*Sin[c
 + d*x]), x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[a^2 + b^2, 0]

Rule 3212

Int[((A_.) + cos[(d_.) + (e_.)*(x_)]*(B_.) + (C_.)*sin[(d_.) + (e_.)*(x_)])/((a_.) + cos[(d_.) + (e_.)*(x_)]*(
b_.) + (c_.)*sin[(d_.) + (e_.)*(x_)]), x_Symbol] :> Simp[(b*B + c*C)*(x/(b^2 + c^2)), x] + Simp[(c*B - b*C)*(L
og[a + b*Cos[d + e*x] + c*Sin[d + e*x]]/(e*(b^2 + c^2))), x] /; FreeQ[{a, b, c, d, e, A, B, C}, x] && NeQ[b^2
+ c^2, 0] && EqQ[A*(b^2 + c^2) - a*(b*B + c*C), 0]

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps \begin{align*} \text {integral}& = \frac {\int \cot (x) \, dx}{a}-\frac {\int \frac {b \cos (x)-a \sin (x)}{a \cos (x)+b \sin (x)} \, dx}{a} \\ & = \frac {\log (\sin (x))}{a}-\frac {\log (a \cos (x)+b \sin (x))}{a} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.37 (sec) , antiderivative size = 20, normalized size of antiderivative = 0.87 \[ \int \frac {\csc (x)}{a \cos (x)+b \sin (x)} \, dx=\frac {\log (\sin (x))-\log (a \cos (x)+b \sin (x))}{a} \]

[In]

Integrate[Csc[x]/(a*Cos[x] + b*Sin[x]),x]

[Out]

(Log[Sin[x]] - Log[a*Cos[x] + b*Sin[x]])/a

Maple [A] (verified)

Time = 0.44 (sec) , antiderivative size = 21, normalized size of antiderivative = 0.91

method result size
default \(\frac {\ln \left (\tan \left (x \right )\right )}{a}-\frac {\ln \left (a +b \tan \left (x \right )\right )}{a}\) \(21\)
parallelrisch \(\frac {\ln \left (\tan \left (\frac {x}{2}\right )\right )-\ln \left (\tan \left (\frac {x}{2}\right )^{2} a -2 b \tan \left (\frac {x}{2}\right )-a \right )}{a}\) \(33\)
norman \(\frac {\ln \left (\tan \left (\frac {x}{2}\right )\right )}{a}-\frac {\ln \left (\tan \left (\frac {x}{2}\right )^{2} a -2 b \tan \left (\frac {x}{2}\right )-a \right )}{a}\) \(36\)
risch \(-\frac {\ln \left ({\mathrm e}^{2 i x}-\frac {i b +a}{i b -a}\right )}{a}+\frac {\ln \left ({\mathrm e}^{2 i x}-1\right )}{a}\) \(44\)

[In]

int(csc(x)/(a*cos(x)+b*sin(x)),x,method=_RETURNVERBOSE)

[Out]

1/a*ln(tan(x))-1/a*ln(a+b*tan(x))

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 44, normalized size of antiderivative = 1.91 \[ \int \frac {\csc (x)}{a \cos (x)+b \sin (x)} \, dx=-\frac {\log \left (2 \, a b \cos \left (x\right ) \sin \left (x\right ) + {\left (a^{2} - b^{2}\right )} \cos \left (x\right )^{2} + b^{2}\right ) - \log \left (-\frac {1}{4} \, \cos \left (x\right )^{2} + \frac {1}{4}\right )}{2 \, a} \]

[In]

integrate(csc(x)/(a*cos(x)+b*sin(x)),x, algorithm="fricas")

[Out]

-1/2*(log(2*a*b*cos(x)*sin(x) + (a^2 - b^2)*cos(x)^2 + b^2) - log(-1/4*cos(x)^2 + 1/4))/a

Sympy [F]

\[ \int \frac {\csc (x)}{a \cos (x)+b \sin (x)} \, dx=\int \frac {\csc {\left (x \right )}}{a \cos {\left (x \right )} + b \sin {\left (x \right )}}\, dx \]

[In]

integrate(csc(x)/(a*cos(x)+b*sin(x)),x)

[Out]

Integral(csc(x)/(a*cos(x) + b*sin(x)), x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 48 vs. \(2 (23) = 46\).

Time = 0.22 (sec) , antiderivative size = 48, normalized size of antiderivative = 2.09 \[ \int \frac {\csc (x)}{a \cos (x)+b \sin (x)} \, dx=-\frac {\log \left (-a - \frac {2 \, b \sin \left (x\right )}{\cos \left (x\right ) + 1} + \frac {a \sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}}\right )}{a} + \frac {\log \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1}\right )}{a} \]

[In]

integrate(csc(x)/(a*cos(x)+b*sin(x)),x, algorithm="maxima")

[Out]

-log(-a - 2*b*sin(x)/(cos(x) + 1) + a*sin(x)^2/(cos(x) + 1)^2)/a + log(sin(x)/(cos(x) + 1))/a

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 22, normalized size of antiderivative = 0.96 \[ \int \frac {\csc (x)}{a \cos (x)+b \sin (x)} \, dx=-\frac {\log \left ({\left | b \tan \left (x\right ) + a \right |}\right )}{a} + \frac {\log \left ({\left | \tan \left (x\right ) \right |}\right )}{a} \]

[In]

integrate(csc(x)/(a*cos(x)+b*sin(x)),x, algorithm="giac")

[Out]

-log(abs(b*tan(x) + a))/a + log(abs(tan(x)))/a

Mupad [B] (verification not implemented)

Time = 21.42 (sec) , antiderivative size = 32, normalized size of antiderivative = 1.39 \[ \int \frac {\csc (x)}{a \cos (x)+b \sin (x)} \, dx=-\frac {\ln \left (-a\,{\mathrm {tan}\left (\frac {x}{2}\right )}^2+2\,b\,\mathrm {tan}\left (\frac {x}{2}\right )+a\right )-\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )\right )}{a} \]

[In]

int(1/(sin(x)*(a*cos(x) + b*sin(x))),x)

[Out]

-(log(a + 2*b*tan(x/2) - a*tan(x/2)^2) - log(tan(x/2)))/a